<?php 
  
  require_once 'lib/HTML/Util.php';
  require_once 'lib/HTML/LinkLoader.php';
  require_once 'lib/HTML/FormElements.php';
  
  if($_POST[op]=='add'){
    require_once 'controllers/Track.php';
    $_POST[op] = null;
    
    $track = new Track($_POST);
    $track->add()->send();
    
    exit();
  }
 
  // JavaScript loader
  $ll = new LinkLoader();

  $ll->loadJs(array('Ajax.js','WebServices/WebService.js',
                    'WebServices/MusicBrainz.js','Components/Track.js',
                    'Components/Article.js','MusicTalk.js'));
  $ll->loadJs('js.js','views/track/add/');
  $ll->loadCSS('form.css');
    
  $smarty->assign("title", "Add a Song");
  $smarty->assign_by_ref("ll", $ll);
  $smarty->assign_by_ref("html",new Util());
  $smarty->assign_by_ref("fe",new FormElements());
  
  $smarty->display("head.tpl");
  $smarty->display("nav.tpl");
  // main content
  $smarty->display("../track/add/view.tpl");
  
  $smarty->display("footer.tpl");
?>

    
    
